package org.jeecg.modules.yusuan.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Description: caiwu_yusuan
 * @Author: jeecg-boot
 * @Date:   2020-06-15
 * @Version: V1.0
 */
@Getter
@Setter
@TableName("caiwu_zhijie")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="caiwu_zhijie对象", description="caiwu_zhijie")
public class CaiwuZhijie implements Serializable {
    private static final long serialVersionUID = 1L;

	/**id*/
	@TableId(type = IdType.ID_WORKER_STR)
    @ApiModelProperty(value = "id")
    private String id;
	/**部门*/
	@Excel(name = "部门", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
	@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
    @ApiModelProperty(value = "部门")
    private String deptId;

	@TableField(exist = false)
	private String sysOrgCode;

	/**科目*/
	@Excel(name = "科目", width = 15)
    @ApiModelProperty(value = "科目")
    private String categoryId;
	/**计量单位*/
	@Excel(name = "计量单位", width = 15)
    @ApiModelProperty(value = "计量单位")
    private String danwei;
	/**数量*/
	@Excel(name = "数量", width = 15)
    @ApiModelProperty(value = "数量")
    private String shuliang;
	/**限额*/
	@Excel(name = "限额", width = 15)
    @ApiModelProperty(value = "限额")
    private String xiane;

	private String hjxiafashu;
	/**合计申请数*/
	@Excel(name = "合计申请数", width = 15)
    @ApiModelProperty(value = "合计申请数")
    private String hjshenqingshu;
	/**合计审核数*/
	@Excel(name = "合计审核数", width = 15)
    @ApiModelProperty(value = "合计审核数")
    private String hjshenheshu;
	/**合计增/减*/
	@Excel(name = "合计增/减", width = 15)
    @ApiModelProperty(value = "合计增/减")
    private String hjzengjian;

	private String jzxiafashu;
	/**集中申请数*/
	@Excel(name = "集中申请数", width = 15)
    @ApiModelProperty(value = "集中申请数")
    private String jzshenqingshu;
	/**集中审核数*/
	@Excel(name = "集中审核数", width = 15)
    @ApiModelProperty(value = "集中审核数")
    private String jzshenheshu;

	private String lxxiafashu;
	/**零星申请数*/
	@Excel(name = "零星申请数", width = 15)
    @ApiModelProperty(value = "零星申请数")
    private String lxshenqingshu;
	/**零星审核数*/
	@Excel(name = "零星审核数", width = 15)
    @ApiModelProperty(value = "零星审核数")
    private String lxshenheshu;
	/**备注*/
	@Excel(name = "备注", width = 15)
    @ApiModelProperty(value = "备注")
    private String memo;
	/**预算审核状态*/
	@Excel(name = "预算审核状态", width = 15)
    @ApiModelProperty(value = "预算审核状态")
    private Integer status;
	/**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
	/**创建时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
	/**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
	/**更新时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

	@TableField(exist = false)
	private String parentId;
    @TableField(exist = false)
	private String treeId;
    @TableField(exist = false)
	private String categoryName;
    @TableField(exist = false)
	private Boolean isLeaf;
    @TableField(exist = false)
	private List<CaiwuZhijie> children;

    @TableField(exist = false)
	private String baoxiaoshu;
	@TableField(exist = false)
	private Boolean display = false;

	@TableField(exist = false)
	private String zchj;


	@Override
	public boolean equals(Object obj) {
		if (obj == null){
			return false;
		}
		if (this == obj){
			return true;
		}
		if (obj instanceof CaiwuZhijie){
			CaiwuZhijie o = (CaiwuZhijie) obj;
			if(this.categoryId != null) {
				return StringUtils.equals(this.categoryId, o.categoryId);
			}else{
				return StringUtils.equals(this.treeId, o.treeId);
			}
		}
		return false;
	}

	@Override
	public int hashCode() {
		if(this.categoryId != null)
			return this.categoryId.hashCode();
		else{
			return this.treeId.hashCode();
		}
	}
}
